import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CourseVO, CourseForm, CourseQuery } from '@/api/bclt/course/types';

/**
 * 查询手环--课程列表
 * @param query
 * @returns {*}
 */

export const listCourse = (query?: CourseQuery): AxiosPromise<CourseVO[]> => {
  return request({
    url: '/bclt/course/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询手环--课程详细
 * @param id
 */
export const getCourse = (id: string | number): AxiosPromise<CourseVO> => {
  return request({
    url: '/bclt/course/' + id,
    method: 'get'
  });
};

/**
 * 新增手环--课程
 * @param data
 */
export const addCourse = (data: CourseForm) => {
  return request({
    url: '/bclt/course',
    method: 'post',
    data: data
  });
};

/**
 * 修改手环--课程
 * @param data
 */
export const updateCourse = (data: CourseForm) => {
  return request({
    url: '/bclt/course',
    method: 'put',
    data: data
  });
};

/**
 * 删除手环--课程
 * @param id
 */
export const delCourse = (id: string | number | Array<string | number>) => {
  return request({
    url: '/bclt/course/' + id,
    method: 'delete'
  });
};
